<?php 
include 'sys_application.php';
$sysApps = new sysApps();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
</head>

<body>

<div id="container">
    <div id="header">
    	<div id="logo"></div>
    </div>
<div id="body">
	<div id="login-image"></div>
	<div id="login-box">
            <h1>LOGIN</h1>
            <div class="frm_rows"> <div class="frm_left">Email </div><div class="frm_right"><INPUT type="text" id="email" name="email" class="inputTextbox"></div></div>
            <div class="frm_rows"> <div class="frm_left">Password</div><div class="frm_right"><INPUT type="password" id="password" name="password" class="inputTextbox"></div></div>
            <div class="frm_rows"> <div class="frm_left"></div><div class="frm_right"><div class="frm_checklogin"><div class="frm_checklogin-msg">test</div></div></div></div>
            <div class="frm_rows"> <div class="frm_left"></div><div class="frm_right"><div class="smallButton">LOGIN</div></div></div>
            <div class="frm_rows"> <div class="frm_left"></div><div class="frm_right">Forgot Your Password?</div></div>
            <div class="frm_rows"> <div class="frm_left"></div><div class="frm_right">New subcriber? Register now</div></div>
        </div>
</div>
<div id="footer"></div>
</div>

<script>

$(document).ready(function(){
	$('.frm_checklogin').hide();
	
	$('.smallButton').click(function(){
		var email = $('#email').val();
		var password = $('#password').val();
		$.post("<?php echo $sysApps->BASEurl();?>/members/func/checklogin.php",{email:email, password:password}, function(response){
			//alert(response);
			//return false;
			switch(response)
			{
			case '1':
			  window.location.href = "<?php echo $sysApps->BASEurl();?>members/";
			  break;
			case '2':
			  $('.frm_checklogin').show("slide",{direction: 'down'});
					$('.frm_checklogin').delay(2000).hide("slide",{direction: 'up'});
					$('.frm_checklogin-msg').removeClass("check_pass").addClass("check_error").text("Password is incorrect");
					$('#email').focus();
					return false;	
			  break;
			case '3':
			  $('.frm_checklogin').show("slide",{direction: 'down'});
					$('.frm_checklogin').delay(2000).hide("slide",{direction: 'up'});
					$('.frm_checklogin-msg').removeClass("check_pass").addClass("check_error").text("Email doesn't exist");
					$('#email').focus();
					return false;	
			  break;
			case '4':
			$('.frm_checklogin').show("slide",{direction: 'down'});
				  $('.frm_checklogin').delay(2000).hide("slide",{direction: 'up'});
				  $('.frm_checklogin-msg').removeClass("check_pass").addClass("check_error").text("Account Not Activated");
				  $('#email').focus();
				  return false;	
			break;
			default:
			  
			}
			
		});
	});
	$(document).keypress(function(e) {
	  if(e.which == 13) {
		  $('.smallButton').click();
		}
	});
});

</script>

</body>
</html>